<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>活动报名管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <link rel="stylesheet" href="${ctx}/css/ui/activity/member_act_list.css">
    <%@include file="../include/commonFile.jsp" %>
    <style type="text/css">
        .layui-table td, .layui-table th {
            padding: 9px 10px;
        }
    </style>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/activity/memberAct/memberActList.do?actId=${activity.id}" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <input id="distributionId" name="distributionId" value="${distributionId}" type="hidden">
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">手机号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mobile" autocomplete="off" class="layui-input" value="${memberAct.mobile}"
                                           placeholder="请输入查询手机号"
                                    >
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">微信号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="wechatNum" autocomplete="off" class="layui-input" value="${memberAct.wechatNum}"
                                           placeholder="请输入查询微信号"
                                    >
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">报名状态：</label>
                                <div class="layui-input-inline">
                                    <select name="checkStatus">
                                        <option value="">全部</option>
                                        <c:forEach var="map" items="${checkStatus}">
                                            <c:if test="${memberAct.checkStatus == map.key}">
                                                <option value="${map.key}" selected="selected">${map.value}</option>
                                            </c:if>
                                            <c:if test="${memberAct.checkStatus != map.key}">
                                                <option value="${map.key}">${map.value}</option>
                                            </c:if>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item-inline" ><label class="search-form-lable">票据类型</label>
                                <div class="layui-input-inline" style="width: 165px" >
                                    <select name="counterfoilType">
                                        <option value="">全部</option>
                                        <option value="1" ${memberAct.counterfoilType == 1 ?'selected="selected"':''}>免费</option>
                                        <option value="2" ${memberAct.counterfoilType == 2 ?'selected="selected"':''}>在线付费</option>
                                        <option value="3" ${memberAct.counterfoilType == 3 ?'selected="selected"':''}>线下付费</option>
                                    </select>
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable"></label></li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">更新时间：</label>
                                <div class="check-btn-inner">
                                    <a id="all" href="javascript:void(0);" onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);" onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart" value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd" value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger" href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal" href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="my-act-list-content">
                <ul class="num">
                    <div class="r">
                        <li style="cursor: pointer;" class="r">
                            <c:if test="${isCommune || isXzgsAdmin}">
                            <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { optObj.addCmember() })">添加报名</a>
                            </c:if>
                            <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { optObj.batchReject() })">拒绝</a>
                            <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { optObj.batchRejectRefund() })">拒绝并退款</a>
                            <a class="layui-btn layui-btn-danger layui-btn-sm" href="javascript:txz.expireCheck('', function() { excelExport() })">导出EXCEL</a>
                        </li>
                    </div>
                    <p class="cl"></p>
                </ul>
                <div class="cl">
                    <table class="layui-table layui-form" lay-skin="line" id="myTable">
                        <colgroup>
                            <col width="50px">
                            <col width="65px">
                            <col>
                            <col>
                            <col width="80px">
                            <col>
                            <col>
                            <col>
                            <col>
                            <c:if test="${isCommune || isXzgsAdmin}">
                                <col width="90px">
                                <col width="80px">
                                <col width="80px">
                            </c:if>
                            <col width="80px">
                            <col>
                            <col>
                            <col width="80px">
                        </colgroup>
                        <thead>
                        <tr>
                            <th><input type="checkbox" id="chkAll" lay-skin="primary" lay-filter="chkAll"/></th>
                            <th>序号</th>
                            <th>参与者</th>
                            <th>手机号</th>
                            <th>微信号</th>
                            <th>票据类型</th>
                            <th>票据名称</th>
                            <th>金额</th>
                            <th>报名状态</th>
                            <c:if test="${isCommune || isXzgsAdmin}">
                                <th>报名来源</th>
                                <th>关联微信</th>
                                <th>是否会员</th>
                            </c:if>
                            <th>签到</th>
                            <th>更新时间</th>
                            <th>操作</th>
                            <th style="text-align: center">展开</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="memberAct" items="${memberActs}" varStatus="st">
                            <tr class="info" data-id="${memberAct.id}">
                                <td><input type="checkbox" value="${memberAct.id}" name="chk" lay-skin="primary" class="goods-chk"
                                           lay-filter="goods-chk"
                                           data-counter-type="${memberAct.counterType}" data-check-status="${memberAct.checkStatus}" /></td>
                                <td>${page.limit * (page.page-1) + st.count}</td>
                                <td class="table-member" onclick="openDialogShow('用户名片','${ctx}/system/member/memberView.do?id=${memberAct.memberId}','400px','470px')">
                                    <div class="member-cell">
                                        <div class="member-logo common-img">
                                            <img src="<c:if test="${ memberAct.logo!= null}">${memberAct.logo}?imageMogr2/auto-orient/crop/126x126</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                        </div>
                                        <div class="member-name ellipsis-1"><a class="blue" title="${memberAct.realname}" href="javascript:void(0);">${memberAct.realname}</a></div>
                                    </div>
                                </td>
                                <td><div>${memberAct.mobile}</div></td>
                                <td><div class="member-name ellipsis-1" title="${memberAct.wechatNum}">${memberAct.wechatNum}</div></td>
                                <td>
                                    <div>
                                        <c:choose>
                                            <c:when test="${memberAct.counterType == 1}">免费</c:when>
                                            <c:when test="${memberAct.counterType == 2}">在线付费</c:when>
                                            <c:when test="${memberAct.counterType == 3}">线下付费</c:when>
                                        </c:choose>
                                    </div>
                                </td>
                                <td><div class="ellipsis-1" title="${memberAct.counterName}">${memberAct.counterName}</div></td>
                                <td>
                                    <div>
                                        <c:if test="${memberAct.counterPrice == 0}">免费报名</c:if>
                                        <c:if test="${memberAct.counterPrice != 0}">¥${memberAct.counterPrice}</c:if>
                                    </div>
                                </td>
                                <td>
                                    <div class="check-status">
                                        <c:choose>
                                            <c:when test="${memberAct.checkStatus == 0}">
                                                <span>审核中</span>
                                            </c:when>
                                            <c:when test="${memberAct.checkStatus == 1}">
                                                <span>待支付</span>
                                            </c:when>
                                            <c:when test="${memberAct.checkStatus == 2}">
                                                <span>审核拒绝</span>
                                            </c:when>
                                            <c:when test="${memberAct.checkStatus == 3}">
                                                <span>报名成功</span>
                                            </c:when>
                                            <c:when test="${memberAct.checkStatus == 4}">
                                                <span>已取消</span>
                                            </c:when>
                                            <c:when test="${memberAct.checkStatus == 5}">
                                                <span>未参与</span>
                                            </c:when>
                                        </c:choose>
                                    </div>
                                </td>
                                <c:if test="${isCommune || isXzgsAdmin}">
                                    <td><div>${memberAct.applyFrom == 0 ? '正常报名' : '后台报名'}</div></td>
                                    <td><div>${memberAct.isBindphone == 0 ? '已关联' : '未关联'}</div></td>
                                    <td><div>${memberAct.isXzgsMember == 1 ? '是' : '否'}</div></td>
                                </c:if>
                                <td><div>${memberAct.signin == 1 ? '已签到' : '未签到'}</div></td>
                                <td><div><fmt:formatDate value="${memberAct.updateDate}" pattern="yyyy-MM-dd HH:mm"/></div></td>
                                <td class="opts-btns tb-opts" style="width: 150px">
                                    <div class="comm-opts">
                                        <c:if test="${memberAct.checkStatus == 0}">
                                            <a class="green" href="javascript:txz.expireCheck('', function() { optObj.check('确认要审核通过该报名吗？', '${memberAct.id}', '1') })" target="_self">通过</a>
                                            <a class="red" href="javascript:txz.expireCheck('', function() { optObj.check('确认要审核拒绝该报名吗？', '${memberAct.id}', '2') })" target="_self">拒绝</a>
                                        </c:if>
                                        <c:if test="${memberAct.checkStatus == 3}">
                                            <c:if test="${memberAct.counterType == 1}">
                                                <a class="red" href="javascript:txz.expireCheck('', function() { optObj.check('确认要拒绝该报名吗？', '${memberAct.id}', '2') })" target="_self">拒绝</a>
                                            </c:if>
                                            <c:if test="${memberAct.counterType == 2}">
                                                <a class="red" href="javascript:txz.expireCheck('', function() { optObj.check2('确认要拒绝并退款该报名吗？', '${memberAct.id}', '2') })" target="_self">拒绝并退款</a>
                                            </c:if>
                                            <c:if test="${isCommune || isXzgsAdmin}">
                                                <c:if test="${memberAct.signin == 0}">
                                                    <a class="red" href="javascript:optObj.check3('确认手动修改为已签到状态吗？', '${memberAct.id}', '1')" target="_self">签到</a>
                                                </c:if>
                                                <c:if test="${empty memberAct.signin}">
                                                    <a class="red" href="javascript:optObj.check3('确认手动修改为已签到状态吗？', '${memberAct.id}', '1')" target="_self">签到</a>
                                                </c:if>
                                                <c:if test="${memberAct.signin == 1}">
                                                    <a class="red" href="javascript:optObj.check3('确认手动修改为未签到状态吗？', '${memberAct.id}', '0')" target="_self">未签到</a>
                                                </c:if>
                                            </c:if>

                                            <c:if test="${memberAct.counterType == 3}">
                                                <c:if test="${memberAct.payStatus == 2}">
                                                    <a class="red setPay-btn" href="javascript:txz.expireCheck('', function() { optObj.setPayStatus('${memberAct.member.realname}', '${memberAct.id}'); })" target="_self">标记为已付款</a>
                                                </c:if>
                                                <a class="red" href="javascript:txz.expireCheck('', function() { optObj.check('确认要拒绝该报名吗？', '${memberAct.id}', '2') })" target="_self">拒绝</a>
                                            </c:if>
                                        </c:if>
                                    </div>
                                </td>
                                <td>
                                    <div class="option">
                                        <i class="iconfont icon-unfold"></i>
                                        <i class="iconfont icon-fold dis-none"></i>
                                    </div>
                                </td>
                            </tr>
                            <tr class="dis-none info-detail">
                                <c:choose>
                                    <c:when test="${isCommune || isXzgsAdmin}">
                                        <td colspan="15">
                                    </c:when>
                                    <c:otherwise>
                                        <td colspan="13">
                                    </c:otherwise>
                                </c:choose>
                                    <div>
                                        <table width="100%" class="childTable layui-table" lay-skin="row" style="margin: 0px">
                                            <tbody>
                                            <c:if test="${not empty memberAct.name}">
                                                <tr>
                                                    <td>联系人</td>
                                                    <td>${memberAct.name}</td>
                                                </tr>
                                            </c:if>
                                            <c:if test="${not empty memberAct.company}">
                                                <tr>
                                                    <td>公司名称</td>
                                                    <td>${memberAct.company}</td>
                                                </tr>
                                            </c:if>
                                            <c:if test="${not empty memberAct.jobTitle}">
                                                <tr>
                                                    <td>公司职位</td>
                                                    <td>${memberAct.jobTitle}</td>
                                                </tr>
                                            </c:if>
                                            <c:if test="${not empty memberAct.extra}">
                                                <tr>
                                                    <td>备注信息</td>
                                                    <td>${memberAct.extra}</td>
                                                </tr>
                                            </c:if>
                                            <c:if test="${not empty memberAct.remarks}">
                                                <tr>
                                                    <td>付款备注</td>
                                                    <td>${memberAct.remarks}</td>
                                                </tr>
                                            </c:if>
                                            </tbody>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div id="page_content" class="page-container"></div>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
    <div id="bmDialog">
        <form class="layui-form p10" action="${ctx}/activity/memberAct/verify2.do" id="infoForm">
            <input type="hidden" name="id" value=""/>
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 30px;padding-left: 0px;">备注<span class="f-verify-red">*</span></label>
                <div class="layui-input-block" style="margin-left: 50px;">
                    <textarea name="remarks" class="layui-textarea"></textarea>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/html" id="form_template">
    {{# for(var i = 0; i < d.fields.length; i++){ }}
        <tr class="other-info">
            {{# var thatValue = ''; }}
            {{# for(var j = 0; j < d.infos.length; j++){ }}
                {{# if(d.fields[i].id == d.infos[j].fieldId){ }}
                    {{# thatValue = d.infos[j].fieldValue }}
                {{# } }}
            {{# } }}
            <td><div style="word-break: break-all;">{{ d.fields[i].title }}</div></td>
            <td><div style="word-break: break-all;">{{ thatValue }}</div></td>
        </tr>
    {{# } }}
</script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    showActive('${input.createStart}', '${input.createEnd}', '#timeType');
    txz.initHeader({
        nav: [{
            name: '活动管理',
            href: '${ctx}/activity/activity/activityList.do'
        }, {
            name: '${activity.title}'
        }, {
            name: '活动报名管理',
            curr: true
        }],
        info: '<span class="f12">共<b>${page.totalCount}</b>条记录',
        btns: [{
            name: '返回',
            icon: 'back',
            href: '${ctx}/activity/activity/activityList.do'
        }]
    });

    //加载分页
    loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});

    var lastCheckType = null;
    var lastCheckStatus = null;
    $(function () {
        layui.use(['laytpl', 'form', 'laydate'], function () {
            var layForm = layui.form, laydate = layui.laydate, laytpl = layui.laytpl;

            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);

            layForm.on('checkbox(chkAll)', function (data) {
                var checked = data.elem.checked;
                if (checked) {
                    $(".goods-chk").each(function (index, ele) {
                        var myCheckType = $(ele).attr('data-counter-type');
                        var myCheckStatus = $(ele).attr('data-check-status');
                        if (lastCheckType == null) {
                            lastCheckType = myCheckType;
                        }
                        if (lastCheckStatus == null) {
                            lastCheckStatus = myCheckStatus;
                        }
                        if (lastCheckType == myCheckType && lastCheckStatus == myCheckStatus) {
                            $(ele).prop("checked", true);
                        }
                    });
                } else {
                    $(".goods-chk").each(function (index, ele) {
                        $(ele).prop("checked", false);
                    });
                    lastCheckType = null;
                    lastCheckStatus = null;
                }
                layForm.render('checkbox');
            });

            layForm.on('checkbox(goods-chk)', function (data) {
                var checked = data.elem.checked;
                if (checked) {
                    if (lastCheckType == null) {
                        lastCheckType = $(data.elem).attr('data-counter-type');
                    }
                    if (lastCheckStatus == null) {
                        lastCheckStatus = $(data.elem).attr('data-check-status');
                    }
                } else {
                    var length = $("#myTable").find(".goods-chk:checked").length;
                    if (length == 0) {
                        lastCheckType = null;
                        lastCheckStatus = null;
                        $("#chkAll").prop('checked', false);
                    }
                }
                layForm.render('checkbox');
            });

            $('#myTable').delegate('.option', 'click', function (e) {
                var formItems;
                var info = $(this).closest('.info');
                if (!info.hasClass('active')) {//打开
                    if (${not empty gatherProject.id}) {
                        var id = $(info).closest("tr").data("id");
                        var content = $(info).next(".info-detail").find("tr:last-child");
                        var length = $(info).next(".info-detail").find(".other-info").length;
                        if (length == 0) {
                            $.ajax({
                                type: 'get',
                                async: false, // 使用同步的方法
                                data: {
                                    targetId: id,
                                    projectId: '${gatherProject.id}',
                                    isNew: util.isValid(formItems) ? false : true
                                },
                                dataType: 'json',
                                success: function (res) {
                                    if (res.success) {
                                        if (!util.isValid(formItems)) {
                                            formItems = res.data.fields;
                                        } else {
                                            res.data.fields = formItems;
                                        }
                                        var getTpl = $("#form_template").html();
                                        laytpl(getTpl).render(res.data, function (html) {
                                            content.after(html);
                                        });
                                    }
                                },
                                url: '${ctx}/gatherForm/form/getFormInfoByTargetId.do'
                            });
                        }
                    }
                    $('.info').removeClass('active');
                    $(".info-detail").removeClass('dis-block');
                    info.toggleClass('active');
                    $(info).next(".info-detail").addClass('dis-block');
                } else {
                    info.toggleClass('active');
                    $(info).next(".info-detail").removeClass('dis-block');
                }
            });
        });
    });

    function excelExport() {
        layer.confirm('确认要导出Excel吗?', {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            var url = "${ctx}/activity/memberAct/export.do?actId=${activity.id}";
            var loadIndex = layer.load(1, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            $.post(url, $("#myForm").serialize(), function (res) {
                top.layer.close(loadIndex);
                if (res.success) {
                    window.location.href = res.data;
                } else {
                    util.layerMsgError(res.description)
                }
            });
            top.layer.close(index);
        });
    }

    var optObj = {
        batchPass : function () {
            try {
                var ids = this._getChecked();
                // 0表示审核中
                if (lastCheckStatus == '0') {
                    this.check('确定要审核通过吗？', ids, '1');
                } else {
                    util.layerMsgError('状态不符合，不能操作');
                }
            } catch (e) {
                util.layerMsgError(e.message);
            }
        },
        batchReject : function () {
            try {
                var ids = this._getChecked();
                // 0表示审核中 3表示支付成功
                if (lastCheckStatus == '0' || (lastCheckStatus == '3' && (lastCheckType == '1' || lastCheckType == '3'))) {
                    this.check('确定要审核拒绝吗？', ids, '2');
                } else {
                    util.layerMsgError('状态不符合，不能操作');
                }
            } catch (e) {
                util.layerMsgError(e.message);
            }
        },
        batchRejectRefund : function () {
            try {
                var ids = this._getChecked();
                // 0表示审核中 3表示支付成功
                if (lastCheckStatus == '3' && lastCheckType == '2') {
                    this.check2('确定要审核拒绝并退款吗？', ids, '2');
                } else {
                    util.layerMsgError('状态不符合，不能操作');
                }
            } catch (e) {
                util.layerMsgError(e.message);
            }
        },
        _getChecked : function () {
            var _array = new Array();
            $("#myTable").find(".goods-chk:checked").each(function (index, ele) {
                _array.push($(ele).val().trim());
            });
            if (_array.length == 0) {
                throw new Error("请选择需要操作的数据");
            }
            return _array.join(',');
        },
        check : function (content, memberActId, checkStatus) {
            var that = this;
            layer.confirm(content, {
                icon: 3,
                title: '系统提示'
            }, function (index) {
                //loading层
                var loadIndex = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                $.post("${ctx}/activity/memberAct/verify.do", {
                    ids: memberActId,
                    checkStatus: checkStatus
                }, function (res) {
                    layer.close(loadIndex);
                    that._callback(res);
                })
            });
        },
        check2 : function (content, memberActId, checkStatus) {
            var that = this;
            layer.confirm(content, {
                icon: 3,
                title: '系统提示'
            }, function (index) {
                //loading层
                var loadIndex = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                $.post("${ctx}/activity/memberAct/verifyRefund.do", {
                    ids: memberActId,
                    checkStatus: checkStatus
                }, function (res) {
                    layer.close(loadIndex);
                    that._callback(res);
                })
            });
        },
        check3 : function (content, memberActId, signinStatus) {
            var that = this;
            layer.confirm(content, {
                icon: 3,
                title: '系统提示'
            }, function (index) {
                //loading层
                var loadIndex = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                $.post("${ctx}/activity/memberAct/updateSigninStatue.do", {
                    id: memberActId,
                    signinStatus: signinStatus
                }, function (res) {
                    layer.close(loadIndex);
                    that._callback1(res);
                })
            });
        },
        _callback1 : function (res) {
            if (res.success) {
                util.layerMsgSuccess("修改成功", function () {
                    window.location.reload();
                })
            } else {
                util.layerMsgSuccess(res.description, function () {
                    window.location.reload();
                })
            }
        },
        _callback : function (res) {
            if (res.success) {
                util.layerMsgSuccess("审核成功", function () {
                    window.location.reload();
                })
            } else {
                var data = res.data;
                if (null != data) {
                    var totalCount = data.totalCount;
                    var errorCount = data.errorCount;
                    var successCount = data.successCount;

                    if (totalCount > 1) {
                        var msg = "本次共操作" + totalCount + "条数据，成功" + successCount + "条，失败" + errorCount + "条。";
                        util.layerAlertError(msg);
                        return;
                    }
                }
                util.layerMsgError("审核失败");
            }
        },
        setPayStatus : function (targetName, targetId) {
            var setPayIndex = layer.open({
                type: 1,
                area: '400px',
                title: '标记为已付款——' + targetName,
                content: $("#bmDialog"),
                btn: ['确定', '取消'],
                success: function () { // 弹出后回调
                    $("#infoForm").find("[name=remarks]").val("");
                    $("#infoForm").find("[name=id]").val(targetId);
                },
                end: function () { // 销毁后回调
                    $("#infoForm").find("[name=remarks]").val("");
                    $("#infoForm").find("[name=id]").val("");
                },
                yes: function () { // 确定按钮
                    var remarks = $("#infoForm [name=remarks]").val();
                    if (remarks == "") {
                        util.layerMsgError("请填写备注")
                    } else {
                        var action = $("#infoForm").attr("action");
                        $.post(action, $('#infoForm').serialize(), function (res) {
                            if (res.success) {
                                util.layerMsgSuccess("提交成功", function () {
                                    submitFunction('#myForm');
                                });
                            } else {
                                util.layerMsgError("提交失败")
                            }
                        });
                        layer.close(setPayIndex);
                    }
                }
            });
        },
        addCmember : function () {
            try {
                var csNum = ${activity.limitNum - activity.joinNum}
                if(csNum==0){
                    util.layerMsgError('该活动已经满员了，请添加票据或增加名额');
                }else{
                    location.href = "${ctx}/activity/activity/memberActView.do?actId=${activity.id}";
                }
            } catch (e) {
                util.layerMsgError(e.message);
            }
        }
    };
</script>
</body>
</html>